export interface PayLoad {
    type: string
    payload: {
      [key: string]: any
    }
  }

  export const addTodo = (text: string) => {
    return {
      type: 'ADD_TODO',
      payload: {
        id: Date.now(),
        text
      }
    }
  }

  // 切换 todo 完成状态
  export const toggleTodo = (id: string | Date) => {
    return {
      type: 'TOGGLE_TODO',
      payload: {
        id
      }
    }
  }


    // 设置列表展示类型
  export const setVisibilityFilter = (filter: string) => {
    return {
      type: 'SET_VISIBILITY_FILTER',
      payload: { filter }
    }
  }
